package com.slz3.business.module.drawManagement.draIntegralLottery.service;

import com.slz3.business.frame.module.Repositorys;
import com.slz3.business.module.drawManagement.draIntegralLottery.domain.DraIntegralLottery;
import com.slz3.business.module.drawManagement.draIntegralLottery.domain.DraIntegralLotteryFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Slf4j
@Service
public class DraIntegralLotteryTransactionalServiceImpl implements DraIntegralLotteryTransactionalService {

    @Override
    public DraIntegralLottery modify(DraIntegralLottery draIntegralLotteryNew) {
        Repositorys.draIntegralLottery.test();
        Repositorys.draIntegralLottery.save(DraIntegralLotteryFactory.initBaseFields());
        System.err.println(1/0);
        draIntegralLotteryNew.setLastModifyTime(LocalDateTime.now());
        return Repositorys.draIntegralLottery.saveAndFlush(draIntegralLotteryNew);
    }

    @Override
    public List<DraIntegralLottery> batchModify(List<DraIntegralLottery> draIntegralLotteryList) {
        return Repositorys.draIntegralLottery.saveAll(draIntegralLotteryList);
    }
}
